package com.oraro.paygatewaybiz.channel.alipay.proxy;

import com.oraro.common.result.Result;
import com.oraro.paygatewaybiz.channel.alipay.interfaces.AliPayService;
import com.oraro.paygatewaybiz.constant.Constants;
import com.oraro.paygatewaybiz.module.entity.ChannelEntity;
import com.oraro.paygatewaybiz.module.entity.OrderEntity;
import com.oraro.plugin.proxy.OraroServiceProxyPluginManager;
import org.springframework.stereotype.Service;

/**
 * @Author: jianghuiyong
 * @Date: 2018/11/16 14:58
 * @Version 1.0
 */
@Service
public class AliPayServiceProxy extends OraroServiceProxyPluginManager<AliPayService> implements AliPayService{

    @Override
    public String type() {
        return Constants.ProxyType.ALIPAYPROXY.getType();
    }

    @Override
    public Result payOrder(OrderEntity orderEntity, ChannelEntity channelEntity) {
        AliPayService aliPayService = selectPlugin(getParam(orderEntity.getTradeType()));
        return aliPayService.payOrder(orderEntity, channelEntity);
    }
}
